﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace baroIstatistik.Class
{
    public class karar2
    {

        istatistikDataContext ist = new istatistikDataContext();
        private int kararID;
        public int KararID { get { return kararID; } }

        private int basvuruID;
        public int BasvuruID { get { return basvuruID; } set { basvuruID = value; } }


        private int userID;
        public int UserID { get { return userID; } set { userID = value; } }

        private string mahkeme;
        public string Mahkeme { get { return mahkeme; } set { mahkeme = value; } }


        private string dosyano;
        public string Dosyano { get { return dosyano; } set { dosyano = value; } }


        private int yili;
        public int Yili { get { return yili; } set { yili = value; } }


        private byte fiziksel;
        public byte Fiziksel { get { return fiziksel; } set { fiziksel = value; } }

        private byte cinsel;
        public byte Cinsel { get { return cinsel; } set { cinsel = value; } }

        private byte ekonomik;
        public byte Ekonomik { get { return ekonomik; } set { ekonomik = value; } }

        private byte psikolojik;
        public byte Psikolojik { get { return psikolojik; } set { psikolojik = value; } }



        private string kimkabuletmis;
        public string Kimkabuletmis { get { return kimkabuletmis; } set { kimkabuletmis = value; } }


        private byte mali;
        public byte Mali { get { return mali; } set { mali = value; } }

        private byte psikolojik2;
        public byte Psikolojik2 { get { return psikolojik2; } set { psikolojik2 = value; } }

        private byte siginma;
        public byte Siginma { get { return siginma; } set { siginma = value; } }
        private byte isbulma;
        public byte Isbulma { get { return isbulma; } set { isbulma = value; } }
        private byte kres;
        public byte Kres { get { return kres; } set { kres = value; } }
        private byte diger;
        public byte Diger { get { return diger; } set { diger = value; } }

        //private string talepedilentedbir;
        //public string Talepedilentedbir { get { return talepedilentedbir; } set { talepedilentedbir = value; } }

        private byte m4abend;
        public byte M4abend { get { return m4abend; } set { m4abend = value; } }

        private byte m4bbend;
        public byte M4bbend { get { return m4bbend; } set { m4bbend = value; } }

        private byte m4cbend;
        public byte M4cbend { get { return m4cbend; } set { m4cbend = value; } }

        private byte m4chbend;
        public byte M4chbend { get { return m4chbend; } set { m4chbend = value; } }

        private byte m51abend;
        public byte M51abend { get { return m51abend; } set { m51abend = value; } }


        private byte m51bbend;
        public byte M51bbend { get { return m51bbend; } set { m51bbend = value; } }


        private byte m51cbend;
        public byte M51acbend { get { return m51cbend; } set { m51cbend = value; } }


        private byte m51chbend;
        public byte M51chbend { get { return m51chbend; } set { m51chbend = value; } }


        private byte m51dbend;
        public byte M51dbend { get { return m51dbend; } set { m51dbend = value; } }


        private byte m51ebend;
        public byte M51ebend { get { return m51ebend; } set { m51ebend = value; } }


        private byte m51fbend;
        public byte M51fbend { get { return m51fbend; } set { m51fbend = value; } }

        private byte m51gbend;
        public byte M51gbend { get { return m51gbend; } set { m51gbend = value; } }

        private byte m51g_bend;
        public byte M51g_bend { get { return m51g_bend; } set { m51g_bend = value; } }

        private byte m51hbend;
        public byte M51hbend { get { return m51hbend; } set { m51hbend = value; } }

        private byte m51ibend;
        public byte M51ibend { get { return m51ibend; } set { m51ibend = value; } }


        private byte m52abend;
        public byte M52abend { get { return m52abend; } set { m52abend = value; } }

        private byte m53abend;
        public byte M53abend { get { return m53abend; } set { m53abend = value; } }

        private byte m54abend;
        public byte M54abend { get { return m54abend; } set { m54abend = value; } }

        private byte m86abend;
        public byte M86abend { get { return m86abend; } set { m86abend = value; } }

        private byte m87abend;
        public byte M87abend { get { return m87abend; } set { m87abend = value; } }


        // karar verilen bölümler
        private byte km4abend;
        public byte kM4abend { get { return km4abend; } set { km4abend = value; } }

        private byte km4bbend;
        public byte kM4bbend { get { return km4bbend; } set { km4bbend = value; } }

        private byte km4cbend;
        public byte kM4cbend { get { return km4cbend; } set { km4cbend = value; } }

        private byte km4chbend;
        public byte kM4chbend { get { return km4chbend; } set { km4chbend = value; } }

        private byte km51abend;
        public byte kM51abend { get { return km51abend; } set { km51abend = value; } }


        private byte km51bbend;
        public byte kM51bbend { get { return km51bbend; } set { km51bbend = value; } }


        private byte km51cbend;
        public byte kM51acbend { get { return km51cbend; } set { km51cbend = value; } }


        private byte km51chbend;
        public byte kM51chbend { get { return km51chbend; } set { km51chbend = value; } }


        private byte km51dbend;
        public byte kM51dbend { get { return km51dbend; } set { km51dbend = value; } }


        private byte km51ebend;
        public byte kM51ebend { get { return km51ebend; } set { km51ebend = value; } }


        private byte km51fbend;
        public byte kM51fbend { get { return km51fbend; } set { km51fbend = value; } }

        private byte km51gbend;
        public byte kM51gbend { get { return km51gbend; } set { km51gbend = value; } }

        private byte km51g_bend;
        public byte kM51g_bend { get { return km51g_bend; } set { km51g_bend = value; } }

        private byte km51hbend;
        public byte kM51hbend { get { return km51hbend; } set { km51hbend = value; } }

        private byte km51ibend;
        public byte kM51ibend { get { return km51ibend; } set { km51ibend = value; } }


        private byte km52abend;
        public byte kM52abend { get { return km52abend; } set { km52abend = value; } }

        private byte km53abend;
        public byte kM53abend { get { return km53abend; } set { km53abend = value; } }

        private byte km54abend;
        public byte kM54abend { get { return km54abend; } set { km54abend = value; } }

        private byte km86abend;
        public byte kM86abend { get { return km86abend; } set { km86abend = value; } }

        private byte km87abend;
        public byte kM87abend { get { return km87abend; } set { km87abend = value; } }


        private byte r4a;
        public byte _r4a { get { return r4a; } set { r4a = value; } }

        private byte r4b;
        public byte _r4b { get { return r4b; } set { r4b = value; } }
        private byte r4c;
        public byte _r4c { get { return r4c; } set { r4c = value; } }
        private byte r4ch;
        public byte _r4ch { get { return r4ch; } set { r4ch = value; } }
        private byte r51a;
        public byte _r51a { get { return r51a; } set { r51a = value; } }
        private byte r51b;
        public byte _r51b { get { return r51b; } set { r51b = value; } }
        private byte r51c;
        public byte _r51c { get { return r51c; } set { r51c = value; } }
        private byte r51ch;
        public byte _r51ch { get { return r51ch; } set { r51ch = value; } }
        private byte r51d;
        public byte _r51d { get { return r51d; } set { r51d = value; } }
        private byte r51e;
        public byte _r51e { get { return r51e; } set { r51e = value; } }
        private byte r51f;
        public byte _r51f { get { return r51f; } set { r51f = value; } }
        private byte r51g;
        public byte _r51g { get { return r51g; } set { r51g = value; } }
        private byte r51g_;
        public byte _r51g_ { get { return r51g_; } set { r51g_ = value; } }
        private byte r51h;
        public byte _r51h { get { return r51h; } set { r51h = value; } }
        private byte r51i;
        public byte _r51i { get { return r51i; } set { r51i = value; } }

        private byte r52;
        public byte _r52 { get { return r52; } set { r52 = value; } }
        private byte r53;
        public byte _r53 { get { return r53; } set { r53 = value; } }

        private byte r54;
        public byte _r54 { get { return r54; } set { r54 = value; } }
        private byte r86;
        public byte _r86 { get { return r86; } set { r86 = value; } }
        private byte r87;
        public byte _r87 { get { return r87; } set { r87 = value; } }



        private string kararverilentedbirsuresi;
        public string Kararverilentedbirsuresi { get { return kararverilentedbirsuresi; } set { kararverilentedbirsuresi = value; } }


        private byte aynikisiyetedbirvarmi;
        public byte Aynikisiyetedbirvarmi { get { return aynikisiyetedbirvarmi; } set { aynikisiyetedbirvarmi = value; } }



        private byte tedbirihlali;
        public byte Tedbirihlali { get { return tedbirihlali; } set { tedbirihlali = value; } }



        private byte zorlamahapisivarmi;
        public byte Zorlamahapisivarmi { get { return zorlamahapisivarmi; } set { zorlamahapisivarmi = value; } }


        private byte baskadestek;
        public byte Baskadestek { get { return baskadestek; } set { baskadestek = value; } }


        private string destekkurum;
        public string Destekkurum { get { return destekkurum; } set { destekkurum = value; } }




        private byte mahkemetalebidestel;
        public byte Mahkemetalebidestel { get { return mahkemetalebidestel; } set { mahkemetalebidestel = value; } }


        private byte redgerekcesi1;
        public byte Redgerekcesi1 { get { return redgerekcesi1; } set { redgerekcesi1 = value; } }

        private byte redgerekcesi2;
        public byte Redgerekcesi2 { get { return redgerekcesi2; } set { redgerekcesi2 = value; } }

        private byte redgerekcesi3;
        public byte Redgerekcesi3 { get { return redgerekcesi3; } set { redgerekcesi3 = value; } }

        private byte redgerekcesi4;
        public byte Redgerekcesi4 { get { return redgerekcesi4; } set { redgerekcesi4 = value; } }

        private string avukatadi;
        public string Avukatadi { get { return avukatadi; } set { avukatadi = value; } }


        private string gorusleri;
        public string Gorusleri { get { return gorusleri; } set { gorusleri = value; } }

        public karar2(int KararID2)
        {
            kararID = KararID2;
        }

        public karar2()
        {
            fiziksel = 0;
            ekonomik = 0;
            cinsel = 0;
            psikolojik = 0;



        }


        public void kaydet()
        {
            karar k = new karar()
            {
                basvuruID = basvuruID,
                userID = userID,
                mahekeme = mahkeme,
                dosyano = dosyano,
                dosyayili = yili,
                fiziksel = fiziksel,
                cinsel = cinsel,
                psikolojik = psikolojik,
                ekonomil = ekonomik,
                kimkabuletmis = kimkabuletmis,
                m4abend = m4abend,
                m4bbend = m4bbend,
                m4cbend = m4cbend,
                m4chbend = m4chbend,
                m51abend = m51abend,
                m51bbend = m51bbend,
                m51cbend = m51cbend,
                m51chbend = m51chbend,
                m51dbend = m51dbend,
                m51ebend = m51ebend,
                m51fbend = m51fbend,
                m51gbend = m51gbend,
                m51g_bend = m51g_bend,
                m51hbend = m51hbend,
                m51ibend = m51ibend,
                m52abend = m52abend,
                m53abend = m53abend,
                m54abend = m54abend,
                m86abend = m86abend,
                m87abend = m87abend,

                km4abend = km4abend,
                km4bbend = km4bbend,
                km4cbend = km4cbend,
                km4chbend = km4chbend,
                km51abend = km51abend,
                km51bbend = km51bbend,
                km51cbend = km51cbend,
                km51chbend = km51chbend,
                km51dbend = km51dbend,
                km51ebend = km51ebend,
                km51fbend = km51fbend,
                km51gbend = km51gbend,
                km51g_bend = km51g_bend,
                km51hbend = km51hbend,
                km51ibend = km51ibend,
                km52abend = km52abend,
                km53abend = km53abend,
                km54abend = km54abend,
                km86abend = km86abend,
                km87abend = km87abend,

                r4a = r4a,
                r4b = r4b,
                r4c = r4c,
                r4ch = r4ch,
                r51a = r51a,
                r51b = r51b,
                r51c = r51c,
                r51ch = r51c,
                r51d = r51d,
                r51e = r51e,
                r51f = r51f,
                r51g = r51g,
                r51g_ = r51g_,
                r51h = r51h,
                r51i = r51i,
                r52 = r52,
                r53 = r53,
                r54 = r54,
                r86 = r86,
                r87 = r87,

                malidest = mali,
                psikolojik2 = psikolojik2,
                siginma = siginma,
                isbulma = isbulma,
                kres = kres,
                diger = diger,

                kararverilentedbirsuresi = kararverilentedbirsuresi,
                aynikisiyetedbirvarmi = aynikisiyetedbirvarmi,
                tedbirihlali = tedbirihlali,
                zorlamahapisivarmi = zorlamahapisivarmi,
                baskadestekvarmi = baskadestek,
                destekkurum = destekkurum,
                mahkemetalebidesteklermi = mahkemetalebidestel,
                redgerekcesi1= redgerekcesi1,
                redgerekcesi2 = redgerekcesi2,
                redgerekcesi3 = redgerekcesi3,
                redgerekcesi4 = redgerekcesi4,

                avukatadi = avukatadi,
                gorusleri = gorusleri

            };

            ist.karars.InsertOnSubmit(k);
            ist.SubmitChanges();

        }

        public void guncelle()
        {
            // siparisler sip = ly.siparislers.Single(sk => sk.sipariskodu == sipariskodu);
            karar kg = ist.karars.Single(sk => sk.basvuruID == basvuruID);
            {
                kg.basvuruID = basvuruID;
                kg.userID = userID;
                kg.mahekeme = mahkeme;
                kg.dosyano = dosyano;
                kg.dosyayili = yili;
                kg.fiziksel = fiziksel;
                kg.cinsel = cinsel;
                kg.psikolojik = psikolojik;
                kg.ekonomil = ekonomik;
                kg.kimkabuletmis = kimkabuletmis;
                kg.m4abend = m4abend;
                kg.m4bbend = m4bbend;
                kg.m4cbend = m4cbend;
                kg.m4chbend = m4chbend;
                kg.m51abend = m51abend;
                kg.m51bbend = m51bbend;
                kg.m51cbend = m51cbend;
                kg.m51chbend = m51chbend;
                kg.m51dbend = m51dbend;
                kg.m51ebend = m51ebend;
                kg.m51fbend = m51fbend;
                kg.m51gbend = m51gbend;
                kg.m51g_bend = m51g_bend;
                kg.m51hbend = m51hbend;
                kg.m51ibend = m51ibend;
                kg.m52abend = m52abend;
                kg.m53abend = m53abend;
                kg.m54abend = m54abend;
                kg.m86abend = m86abend;
                kg.m87abend = m87abend;

                kg.km4abend = km4abend;
                kg.km4bbend = km4bbend;
                kg.km4cbend = km4cbend;
                kg.km4chbend = km4chbend;
                kg.km51abend = km51abend;
                kg.km51bbend = km51bbend;
                kg.km51cbend = km51cbend;
                kg.km51chbend = km51chbend;
                kg.km51dbend = km51dbend;
                kg.km51ebend = km51ebend;
                kg.km51fbend = km51fbend;
                kg.km51gbend = km51gbend;
                kg.km51g_bend = km51g_bend;
                kg.km51hbend = km51hbend;
                kg.km51ibend = km51ibend;
                kg.km52abend = km52abend;
                kg.km53abend = km53abend;
                kg.km54abend = km54abend;
                kg.km86abend = km86abend;
                kg.km87abend = km87abend;

                kg.kararverilentedbirsuresi = kararverilentedbirsuresi;
                kg.aynikisiyetedbirvarmi = aynikisiyetedbirvarmi;
                kg.tedbirihlali = tedbirihlali;
                kg.zorlamahapisivarmi = zorlamahapisivarmi;
                kg.baskadestekvarmi = baskadestek;
                kg.destekkurum = destekkurum;
                kg.mahkemetalebidesteklermi = mahkemetalebidestel;

                kg.r4a = r4a;
                kg.r4b = r4b;
                kg.r4c = r4c;
                kg.r4ch = r4ch;
                kg.r51a = r51a;
                kg.r51b = r51b;
                kg.r51c = r51c;
                kg.r51ch = r51c;
                kg.r51d = r51d;
                kg.r51e = r51e;
                kg.r51f = r51f;
                kg.r51g = r51g;
                kg.r51g_ = r51g_;
                kg.r51h = r51h;
                kg.r51i = r51i;
                kg.r52 = r52;
                kg.r53 = r53;
                kg.r54 = r54;
                kg.r86 = r86;
                kg.r87 = r87;


                kg.malidest = mali;
                kg.psikolojik2 = psikolojik2;
                kg.siginma = siginma;
                kg.isbulma = isbulma;
                kg.kres = kres;
                kg.diger = diger;
                kg.redgerekcesi1= redgerekcesi1;
                kg.redgerekcesi2= redgerekcesi2;
                kg.redgerekcesi3= redgerekcesi3;
                kg.redgerekcesi4= redgerekcesi4;
                kg.avukatadi = avukatadi;
                kg.gorusleri = gorusleri;


            };

            ist.SubmitChanges();

        }

        public void getir()
        {
            var kar = from k in ist.karars
                      where k.basvuruID == basvuruID
                      select k;


            foreach (var item in kar)
            {
                basvuruID = Convert.ToInt32(item.basvuruID);
                userID = Convert.ToInt32(item.userID);
                mahkeme = item.mahekeme.ToString();
                dosyano = item.dosyano.ToString();
                yili = Convert.ToInt32(item.dosyayili);
                fiziksel = Convert.ToByte(item.fiziksel);
                cinsel = Convert.ToByte(item.cinsel);
                psikolojik = Convert.ToByte(item.psikolojik);
                ekonomik = Convert.ToByte(item.ekonomil);
                kimkabuletmis = item.kimkabuletmis.ToString();
                //talepedilentedbir = item.talepedilentedbir.ToString();
                m4abend = (byte)item.m4abend;
                m4bbend = (byte)item.m4bbend;
                m4cbend = (byte)item.m4cbend;
                m4chbend = (byte)item.m4chbend;
                m51abend = (byte)item.m51abend;
                m51bbend = (byte)item.m51bbend;
                m51cbend = (byte)item.m51cbend;
                m51chbend = (byte)item.m51chbend;
                m51dbend = (byte)item.m51dbend;
                m51ebend = (byte)item.m51ebend;
                m51fbend = (byte)item.m51fbend;
                m51gbend = (byte)item.m51gbend;
                m51g_bend = (byte)item.m51g_bend;
                m51hbend = (byte)item.m51hbend;
                m51ibend = (byte)item.m51ibend;

                m52abend = (byte)item.m52abend;
                m53abend = (byte)item.m53abend;
                m54abend = (byte)item.m54abend;
                m86abend = (byte)item.m86abend;
                m87abend = (byte)item.m87abend;

                km4abend = (byte)item.km4abend;
                km4bbend = (byte)item.km4bbend;
                km4cbend = (byte)item.km4cbend;
                km4chbend = (byte)item.km4chbend;
                km51abend = (byte)item.km51abend;
                km51bbend = (byte)item.km51bbend;
                km51cbend = (byte)item.km51cbend;
                km51chbend = (byte)item.km51chbend;
                km51dbend = (byte)item.km51dbend;
                km51ebend = (byte)item.km51ebend;
                km51fbend = (byte)item.km51fbend;
                km51gbend = (byte)item.km51gbend;
                km51g_bend = (byte)item.km51g_bend;
                km51hbend = (byte)item.km51hbend;
                km51ibend = (byte)item.km51ibend;

                km52abend = (byte)item.km52abend;
                km53abend = (byte)item.km53abend;
                km54abend = (byte)item.km54abend;
                km86abend = (byte)item.km86abend;
                km87abend = (byte)item.km87abend;



                kararverilentedbirsuresi = item.kararverilentedbirsuresi.ToString();
                aynikisiyetedbirvarmi = Convert.ToByte(item.aynikisiyetedbirvarmi);
                tedbirihlali = Convert.ToByte(item.tedbirihlali);
                zorlamahapisivarmi = Convert.ToByte(item.zorlamahapisivarmi);
                baskadestek = Convert.ToByte(item.baskadestekvarmi);
                destekkurum = item.destekkurum.ToString();
                mahkemetalebidestel = Convert.ToByte(item.mahkemetalebidesteklermi);

                r4a = (byte)item.r4a;
                r4b = (byte)item.r4b;
                r4c = (byte)item.r4c;
                r4ch = (byte)item.r4ch;

                r51a = (byte)item.r51a;
                r51b = (byte)item.r51b;
                r51c = (byte)item.r51c;
                r51ch = (byte)item.r51ch;
                r51d = (byte)item.r51d;
                r51e = (byte)item.r51e;
                r51f = (byte)item.r51f;
                r51g = (byte)item.r51g;
                r51g_ = (byte)item.r51g_;
                r51h = (byte)item.r51h;
                r51i = (byte)item.r51i;
                r52 = (byte)item.r52;
                r53 = (byte)item.r53;
                r54 = (byte)item.r54;
                r86 = (byte)item.r86;
                r87 = (byte)item.r87;

                mali = (byte)item.malidest;
                psikolojik2 = (byte)item.psikolojik2;
                siginma = (byte)item.siginma;
                isbulma = (byte)item.isbulma;
                kres = (byte)item.kres;
                diger = (byte)item.diger;


                redgerekcesi1 = (byte)item.redgerekcesi1;
                redgerekcesi2 = (byte)item.redgerekcesi2;
                redgerekcesi3 = (byte)item.redgerekcesi3;
                redgerekcesi4 = (byte)item.redgerekcesi4;
                avukatadi = item.avukatadi.ToString();
                gorusleri = item.gorusleri.ToString();
            }

        }

        public void sil()
        {

            SqlConnection sqlcon = connection.baglanti;
            SqlCommand sqlcmd = new SqlCommand("delete from karar where kararID=@kararID", sqlcon);
            sqlcmd.Parameters.AddWithValue("@kararID", kararID);
            sqlcon.Open();
            sqlcmd.ExecuteNonQuery();
            sqlcon.Close();
        }





    }
}